package rpc

import "strconv"

const (
	HTTP  = "HTTP"
	HTTP2 = "HTTP2"
	HTTPS = "HTTPS"
	TCP   = "TCP"
)
const (
	GET      = "GET"
	POSTForm = "POST_FORM"
	POSTJson = "POST_Json"
)

type Config struct {
	Protocol string
	Host     string
	Port     int
	Ssl      bool
}

func (c Config) Url() string {
	var prefix string
	switch c.Protocol {
	case HTTP, HTTP2:
		prefix = "http://"
	case HTTPS:
		prefix = "https://"
	default:
		prefix = "http://"
	}
	if c.Ssl {
		prefix = "https://"
	}
	return prefix + c.Host + ":" + strconv.FormatInt(int64(c.Port), 10)
}
